<?php
class Dungeons extends Zend_Db_Table_Abstract 
{
	protected $_name = 'dungeons';
	protected $_rowClass = 'DungeonRow';
	protected $_dependentTables = array('Bosses','RaidsDungeons','RaidDungeonChanges');
	/*
	protected $_referenceMap = array(
		'DkpPools'	=> 	array(
						'columns' 		=> array('dkp_pool_id'),
						'refTableClass' => 'DkpPools',
						'refColumns' 	=> array('id')
						)
	);
    */
	
	public static $EXPANSION_CLASSIC = 0;
	public static $EXPANSION_TBC = 1;
	public static $EXPANSION_WOTLK = 2;
	
	/**
	 * Short hand for getting a raid by its id.
	 * 
	 * This function does mysql safe escaping on the raid id.
	 *
	 * @param 	int 			raid id
	 * @return 	RaidRow|null
	 */
	public static function getById($dungeonId)
	{	
		// Raid id must be numeric
		if (!is_numeric($dungeonId)) {
			return null;
		}
		
		// Create static self
		$table = new self();
		
		// Create a select for getting the raid
		$select = $table->select()->where("id = ?", $dungeonId);
		$raid = $table->fetchRow($select);
		
		// Return the raid or null
		if ($raid) {
			return $raid;
		} else {
			return null;
		}
	}
	
}
?>